<template>
  <div class="Swipe">
    <van-swipe :autoplay="3000">
      <van-swipe-item v-for="(image, index) in images" :key="index">
        <img v-lazy="image.pic" />
      </van-swipe-item>
    </van-swipe>
  </div>
</template>

<script>
export default {
  name: "Swipe",
  data() {
    return {
      images: [],
    };
  },
  methods: {
      async getBanner(){
      let res = await this.$axios
        .get("/banner?type=2")
        .then((res) => {
          this.images = res.data.banners;
        })
        .catch((err) => {
          console.log(err);
        });
    }
  },
  mounted() {
    this.getBanner();
  },
};
</script>

<style scoped>
.Swipe {
  padding: 0 0.2rem;
}
.van-swipe {
  height: 3rem;
  border-radius: 0.2rem;
}
.van-swipe-item img {
  width: 100%;
  height: 3rem;
}
</style>